<%@page import="com.myapp.struts.SearchEngine.Solution"%>
<%@page import="com.myapp.struts.SearchEngine"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="css/result.css" />
        <title>Search Result</title>
    </head>
    <body>
        <div class="header">
            <div class="logo">
                <img src="images/logo.png" width="300" height="50" alt="WonderSearch Logo"/>
            </div>
        </div>
        <hr/>
        <div class="result">
            <jsp:useBean id="form" scope="page" type="com.myapp.struts.SearchForm" class="com.myapp.struts.SearchForm"/>
            <jsp:setProperty name="form" property="*"/>
            <%
                Boolean isKMP, isDFS, isTitleOnly;
                if(form.getStringalgo().equals("KMP"))
                    isKMP = true;
                else
                    isKMP = false;
                if(form.getBrowsealgo().equals("DFS"))
                    isDFS = true;
                else
                    isDFS = false;
                if(form.getSoption().equals("T"))
                    isTitleOnly = true;
                else
                    isTitleOnly = false;
                SearchEngine _search = new SearchEngine(form.getKeyword(),form.getLink(),isDFS,isTitleOnly,isKMP);

            %>

            <% for (Solution s : _search.results){%>
            <div class="searchresult">
                <a href="resultdetail.jsp?path=<%=s.link%>" target="_blank"><%=s.title%> [<%= s.extension %>]</a>
                <p><%=s.keyword%></p>
            </div>
            <%
                }
            %>
            <p></p>
        </div>
    </body>
</html>
